package io.zso.dto;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.zso.commons.tools.validator.group.AddGroup;
import io.zso.commons.tools.validator.group.DefaultGroup;
import io.zso.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Null;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * 用户管理
 *
 * @author hp@zso.io
 * @since 1.0.0
 */
@Data
@ApiModel(value = "用户概要信息")
public class SysUserProfileDTO implements Serializable {
    private static final long serialVersionUID = 1L;

	@ApiModelProperty(value = "id")
	@Null(message="{id.null}", groups = AddGroup.class)
	@NotNull(message="{id.require}", groups = UpdateGroup.class)
	private Long id;

	@ApiModelProperty(value = "用户名", required = true)
	@NotBlank(message="{sysuser.username.require}", groups = DefaultGroup.class)
	private String username;

	@ApiModelProperty(value = "姓名", required = true)
	@NotBlank(message="{sysuser.realname.require}", groups = DefaultGroup.class)
	private String realName;

	@ApiModelProperty(value = "头像")
	private String avatar;

	@ApiModelProperty(value = "性别   0：男   1：女    2：保密", required = true)
	@Range(min=0, max=2, message = "{sysuser.gender.range}", groups = DefaultGroup.class)
	private Integer gender;

	@ApiModelProperty(value = "邮箱", required = false)
	private String email;

	@ApiModelProperty(value = "手机号", required = false)
	private String mobile;

	@ApiModelProperty(value = "超级管理员   0：否   1：是")
	@Range(min=0, max=1, message = "{sysuser.superadmin.range}", groups = DefaultGroup.class)
	private Integer superAdmin;

	@ApiModelProperty(value = "超级租户   0：否   1：是")
	@JsonProperty(access = JsonProperty.Access.READ_ONLY)
	private Integer superTenant;

	@ApiModelProperty(value = "角色ID列表")
	private Set<Long> roles = new HashSet<>();

	@ApiModelProperty(value = "权限列表")
	private Set<String> ability = new HashSet<>();

	@ApiModelProperty(value = "部门名称")
	private String deptName;

	@JsonIgnore
	@ApiModelProperty(value = "租户编号")
	private String tenantCode;

	@ApiModelProperty(value = "租户名称")
	private String tenantName;

}